package com.lightheart.sphr.xiaobinggan.titlebar.ui

import android.util.TypedValue
import android.view.View
import com.hjq.bar.OnTitleBarListener
import com.hjq.bar.TitleBar
import com.hjq.toast.ToastUtils
import com.lightheart.sphr.xiaobinggan.R
import com.lightheart.sphr.xiaobinggan.base.BaseActivity
import com.lightheart.sphr.xiaobinggan.module.home.presenter.HomePresenter

//https://github.com/getActivity/TitleBar
class TitleBarActivity : BaseActivity<HomePresenter>() {


    override fun getLayoutId() = R.layout.activity_title_bar

    override fun initInjector() {
    }

    override fun initView() {
        val mTitleBar = findViewById<TitleBar>(R.id.tb_main_bar)
        val tvTitleBar = findViewById<TitleBar>(R.id.tvTitleBar)
        tvTitleBar.setTitleSize(TypedValue.COMPLEX_UNIT_SP, 20f)
        tvTitleBar.setRightSize(TypedValue.COMPLEX_UNIT_SP, 20f)
        mTitleBar.setOnTitleBarListener(object : OnTitleBarListener {
            override fun onLeftClick(v: View) {
                ToastUtils.show("左项 View 被点击")
            }

            override fun onTitleClick(v: View) {
                ToastUtils.show("中间 View 被点击")
            }

            override fun onRightClick(v: View) {
                ToastUtils.show("右项 View 被点击")
            }
        })
    }

}